package com.qf.xiaomi.dao.impl;

import com.qf.xiaomi.dao.OrderDetailDao;
import com.qf.xiaomi.pojo.OrderDetail;
import com.qf.xiaomi.utils.DataSourceUtils;
import org.apache.commons.dbutils.QueryRunner;

import java.sql.SQLException;

/**
 * @author 千锋教育
 * @Company http://www.mobiletrain.org/
 * @Version 1.0
 */
public class OrderDetailDaoImpl implements OrderDetailDao {
    @Override
    public void insert(OrderDetail orderDetail) {
        QueryRunner qr = new QueryRunner();

        String sql = "INSERT INTO `tb_orderdetail` (`id`, `Oid`, `pid`, `num`, `Money`) VALUES (null, ?,?,?,?)";

        try {
            qr.update(DataSourceUtils.getConnection(), sql, orderDetail.getOid(),orderDetail.getPid(), orderDetail.getNum(),orderDetail.getMoney());
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}
